package org.linlinjava.litemall.core.express;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public enum ActionStatusEnum {

    /**
     * 分类简称
     */
    ONE("0", "暂无轨迹信息"),
    TWO("1", "已揽收"),
    THREE("2", "在途中"),
    FOUR("201", "达到派件城市"),
    FIVE("202", "派件中"),
    D("211", "已放入快递柜或驿站"),
    SIX("3", "已签收"),
    SEVEN("301", "正常签收"),
    EIGHT("302", "派件异常后最终签收"),
    ELEVEN("304", "代收签收"),
    TWELVE("311", "快递柜或驿站签收"),
    THIRTEEN("4","问题件"),
    TEST("401","发货无信息"),
    FOURTEEN("402","超时未签收"),
    YES("403","超时未更新"),
    NO("404","拒收（退件）"),
    S("405","派件异常"),
    A("406","退货签收"),
    B("407","退货未签收"),
    C("412","快递柜或驿站超时未取"),
    E("10","待揽件");

    private String code;

    private String text;

    ActionStatusEnum(String code, String text){
        this.code = code;
        this.text = text;
    }
    public String getCode() {
        return code;
    }

    public String getAlias() {
        return text;
    }

    public static String getTextByCode(String code) {
        ActionStatusEnum actionStatusEnum = Arrays.stream(ActionStatusEnum.values()).filter(one -> one.getCode().equals(code)).findFirst().orElse(null);
        return actionStatusEnum == null ? null : actionStatusEnum.getAlias();

    }
    public static List<String> getCodes(){
        return Arrays.stream(ActionStatusEnum.values())
                .map(ActionStatusEnum::getCode)
                .collect(Collectors.toList());
    }

}
